home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / HENSA / SCREENSAVER / BLANKCTR.ZIP / blankctrl / ReadMe < prev   
Text File  |  1996-04-22  |  5KB  |  128 lines

  1. BlankCtrl Version 1.10 Copyright (C) 1994-1996 Alun Jones, auj@aber.ac.uk
  2.  
  3. BlankCtrl is Freeware. You may distribute it freely, either alone, or as
  4. part of your own application, under the following conditions:
  5.  
  6. 1) This file must accompany any copy of BlankCtrl distributed - otherwise,
  7.    how will people know how to use it?!
  8.  
  9. 2) If you distribute it as part of an application which is Freeware, I'd
  10.    love to hear from you, mainly so I can keep people uptodate on any
  11.    improvements.
  12.  
  13. 3) If you distribute it as part of a package or collection for which you
  14.    charge, I'd like a free copy of the package/collection for myself. 
  15.    (This is the greed clause ;-)
  16.  
  17. 4) I don't guarantee its suitability for any purpose and disclaim any
  18.    responsibility for damage caused by its use or misuse. However, I'll be
  19.    glad to try to solve any problems you have using BlankCtrl, and will make
  20.    a reasonable effort to keep it uptodate with future versions of
  21.    ScreenBlanker.
  22.  
  23. BlankCtrl is a module which hacks the RISC OS 3.1 and 3.5 screenblanker
  24. modules. It supplies five SWIs:
  25.  
  26. Blank_Check       - Returns R0=1 if the screen is blank, 0 otherwise.
  27. Blank_Blank       - Forces the screenblank timer to R0/5 seconds. So, 
  28.                     SYS "Blank_Blank", 5 will make the screen blank in 1s.
  29. Blank_Unblank     - Forces the screen to unblank immediately.
  30.  
  31. The following SWIs provide support for monitoring the state of the
  32. screenblanker from the WIMP.
  33.  
  34. Blank_ClaimFlag   - Returns the address of a flag in R0. This flag can be
  35.                     used as a WIMP Poll Word. When the screen blanks, the
  36.                     word is set to 1, when it unblanks, the word is set to
  37.                     2. You may write to the word. Note that, in order to
  38.                     make sure that the Poll Word is safe against module
  39.                     deletion, ClaimFlag locks the module against removal.
  40. Blank_ReleaseFlag - Releases the lock on the flag. 
  41.  
  42. The simple BASIC program below, (also saved in !Demo) gives a demonstration
  43. of how to use these calls to implement an animated screensaver using the
  44. ScreenBlanker to do all the hard work.
  45.  
  46. Finally, BlankCtrl supplies a trigger for the blanker:
  47.  
  48. If the mouse pointer is clicked in the bottom left corner of the screen
  49. then, after half a second, the timer set to about 0.2 seconds. This is
  50. useful for forcing the screenblank on when you need to leave the computer or
  51. if you want to force screen DMA off while running something processor
  52. intensive in a high bandwidth screen mode. (of course if you move the mouse
  53. after the 0.5s delay then ScreenBlanker will reset its timer.)
  54.  
  55. The module works by first checking the screenblanker module version. If the
  56. version number is right then the blanker's module workspace base is read.
  57. The Blank_* SWIs can then read or write to the workspace and subvert
  58. screenblanker's timers.
  59.  
  60. ---------------- Simple demo of Poll Word usage follows
  61. REM >!RunImage
  62.  
  63. REM Copyright (C) 1996 Alun Jones, auj@aber.ac.uk
  64.  
  65. REM Simple BlankCtrl Usage example. This uses a poll word
  66. REM to catch the screenblank, then forces it to unblank, and
  67. REM messes around with the contents of the screen until the mouse
  68. REM is moved. Note that while the blanker is running, the computer
  69. REM doesn't multitask. This is only a demo, after all!
  70.  
  71. REM Claim the screenblank flag - this is used as a poll word.
  72. SYS "Blank_ClaimFlag" TO PW%:!PW%=0
  73.  
  74. REM Startup task.
  75. DIM block% &100, err% &100
  76. SYS "Wimp_Initialise",300,&4B534154,"BlankCtrl Demo"
  77. ON ERROR PROCError:PROCEnd
  78.  
  79. quit%=0
  80. REPEAT
  81.   REM Wait for Poll word != 0.
  82.   SYS "Wimp_Poll",&401973,block%,,PW% TO reason%
  83.   CASE reason% OF
  84.     REM Poll World reason code
  85.     WHEN 13 :
  86.       REM !PW=1 => Screen has blanked. 2 => Unblanked (which we ignore).
  87.       IF !PW%=1 THEN
  88.         REM Silly desktop masher until mouse move. Note, we have to
  89.         REM ensure that the screen stays unblanked by calling
  90.         REM Blank_UnBlank every now and then.
  91.         MOUSE U%,V%,S%
  92.         REPEAT
  93.  
  94.           SYS "Blank_UnBlank"
  95.  
  96.           S%=RND(100)
  97.           X%=RND(1278-S%):Y%=RND(1020-S%)
  98.           DX%=RND(8)-4:DY%=RND(8)-4
  99.           RECTANGLE X%,Y%,S%,S% TO X%+DX%,Y%+DY%
  100.           MOUSE X%,Y%,S%
  101.         UNTIL X%<>U% OR Y%<>V%
  102.  
  103.         REM Restore the screen's original state.
  104.         SYS "Wimp_ForceRedraw", -1, 0, 0, 1280, 1024
  105.       ENDIF
  106.       REM Unset the pollword, ready for the next time.
  107.       !PW%=0
  108.     WHEN 17,18 :
  109.     CASE block%!16 OF
  110.       WHEN 0 : quit%=TRUE
  111.     ENDCASE
  112.   ENDCASE
  113. UNTIL quit%
  114. PROCEnd
  115. END
  116.  
  117. DEFPROCEnd
  118.   SYS "Wimp_CloseDown"
  119.   SYS "Blank_ReleaseFlag"
  120.   END
  121. ENDPROC
  122.  
  123. DEF PROCError
  124.   !err%=ERR
  125.   $(err%+4)=REPORT$+CHR$(0)
  126.   SYS"Wimp_ReportError",err% ,1,"BlankCtrl"
  127. ENDPROC
  128.